# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=markupsafe
pkgbase="python-${_realname}"
pkgname=("python3-${_realname}" "python2-${_realname}")
pkgver=1.1.1
pkgrel=1
pkgdesc="Implements a XML/HTML/XHTML Markup safe string for Python"
arch=('i686' 'x86_64')
license=('custom')
url="https://pypi.python.org/pypi/MarkupSafe"
makedepends=("python2-setuptools" "python3-setuptools")
source=("https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-${pkgver}.tar.gz")
sha256sums=('29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b')

build() {
  cd "$srcdir"

  rm -rf python{2,3}-build
  for builddir in python{2,3}-build; do
    cp -r MarkupSafe-$pkgver $builddir
    pushd $builddir
    /usr/bin/${builddir%-build} setup.py build
    popd
  done
}

package_python3-markupsafe() {
  depends=("python3")

  cd "$srcdir/python3-build"
  /usr/bin/python3 setup.py install --prefix=/usr --root="$pkgdir" -O1

  install -Dm644 LICENSE.rst "${pkgdir}/usr/share/licenses/python3-${_realname}/LICENSE"
}

package_python2-markupsafe() {
  depends=("python2")

  cd "$srcdir/python2-build"
  /usr/bin/python2 setup.py install --prefix=/usr --root="$pkgdir" -O1

  install -Dm644 LICENSE.rst "${pkgdir}/usr/share/licenses/python2-${_realname}/LICENSE"
}
